#include <iostream>
#include <typeinfo>
#include <cstdlib>
using namespace std;

struct Stu
{
    string name;
    int age;
    void show()
    {
        cout << "二零二四年十二月二十三号" << endl;
    }
};

void show()
{
    cout << "开心赚大钱" << endl;
}

int main(int argc ,const char *argv[])
{
    int a = 100;
    int* p = &a;
    cout << *p << endl;

    int arr[3] = {1,2,3};
    //int* p1 = &arr;// int(*)[3]
    cout << typeid(&arr).name() << endl;
    int (*p2)[3] = &arr;

    cout << **p2 << endl;

    void (*pfun)() = show;
    pfun();

    //获取成员函数的执行地址的方式：& + 结构体域 + :: 结构体域中的成员函数名
    void (Stu::*member_pfunc)() = &Stu::show;

    //通过成员函数指针如何调用？必须依赖于对象
    Stu stu = {"zhangsan",18};
    (stu.*member_pfunc)();

    Stu *pstu = (Stu*)malloc(sizeof(Stu));
    (pstu->*member_pfunc)();
    
    return 0;
}